var express = require('express')
const router = express.Router()
const path = require('path')
const fs = require('fs')
const util = require('../util/util')
const SERVICEIDMAP = { // serviceId 枚举
    intervenelV2: "userIntervalModuleService.intervenelV2", // 提交回访
    gethealthFileDetailV2: "doctorModuleService.gethealthFileDetailV2", // 查看健康档案
    queryIntervenelRecordDetailV2: "userIntervalModuleService.queryIntervenelRecordDetailV2",  // 查看回访
    saveHealthFileV2: "doctorModuleService.saveHealthFileV2",
    getReportAbnormalExp: "userIntervalModuleService.getReportAbnormalExp",
    queryIntervenelRecordList: "userIntervalModuleService.queryIntervenelRecordList" // 查询回访记录列表
}

router.use(function(req, res, next){
    next()
})
router.post('/yjkCallService/callYjkService', function(req, res){
    const { serviceId } = req.body
    switch (serviceId) {
        case SERVICEIDMAP.intervenelV2:
            res.send({
                code: 0,
                data: null,
                msg: "提交成功"
            });
            break;
        case SERVICEIDMAP.gethealthFileDetailV2:
            returnGethealthFileDetailV2(res)
            break;
        case SERVICEIDMAP.queryIntervenelRecordDetailV2: // 查看回访
            returnQueryIntervenelRecordDetailV2(res)
            break;
        case SERVICEIDMAP.getReportAbnormalExp: // 查询异常推荐方案
            returnGetReportAbnormalExp(res)
            break;
        case SERVICEIDMAP.saveHealthFileV2:
            res.send({code: 0, data: null, msg: "提交成功"});
            break;
        case SERVICEIDMAP.queryIntervenelRecordList: // 查询回访记录列表
            returnQueryIntervenelRecordList(res)
            break;
        default:
            res.sendStatus(500)
    }
})
function returnQueryIntervenelRecordList(res){
    res.send({
        code: 0,
        list: [
            {
                interveneRecordId: '123',
                gmtCreated: "2020-09-16"
            },
            {
                interveneRecordId: '456',
                gmtCreated: "2020-09-15"
            }
        ]
    })
}
function returnGetReportAbnormalExp(res){
    res.send({
        code: 0,
        data: {
            abnormalDesc: "一并异常一并异常一并异常一并异常一并异常",
            healthAdvice: "健康建议健康建议健康建议健康建议健康建议健康建议"
        }
    })
}
function returnQueryIntervenelRecordDetailV2(res){
    res.send({
        code: 0,
        data: {
            rightOrderNo: 'rightOrderNo',
            userId: "userId",
            serviceType: "SMS",
            patientRepayType: "ALREADY_KNOW",
            smsContent: "smsContentsmsContent",
            nextInterveneDate: "2020-09-14",
            needNextIntervene: "Y",
            suggest: "suggestsuggest",
            userCondition: "用户状况	",
            doctorCode: "123213123123123",
            doctorName: "当前医生",
            gmtCreated: "2020-07-23",
            improveRocords:[
                {habitType: "SMOKE", currentState: "一天20根", improveSuggest: "每天少抽一根", complianceStatus: "EXCELLENT"},
                {habitType: "DRINK", currentState: "一天20根", improveSuggest: "每天少抽一根", complianceStatus: "EXCELLENT"},
                {habitType: "OTHER", currentState: "一天20根", improveSuggest: "每天少抽一根", complianceStatus: "EXCELLENT"},
            ],
            monitorIndexs:[
                {indexType: "WEIGHT", indexVal: "123", indexUnitType: "KG", indexRecordDate: '20202020'},
                {indexType: "BMI", indexVal: "123", indexUnitType: "KG_M_2", indexRecordDate: '20202020'},
                {indexType: "SBP", indexVal: "123", indexUnitType: "MMHG", indexRecordDate: '20202020'},
            ]

        }
    })
}
function returnGethealthFileDetailV2(res){
    res.send({
        code: 0,
        data: {
            basicInformationDTO: {
                height: 170,
                weight: 10,
                waistline: "腰围",
                hips: "腿围",
                bloodPressure: "血压",
                allergies: "过敏史",
                mbi: "体质指数",
                whr: "腰臀围比值",
                remark: "备注"
            },
            userInfoVo: {
                userName: "name",
                sex: "男",
                birthday: "2020-09-14",
                age: 18
            },
            "reportAbnormalList": [
                {"checkDate": "2020-09-14", "abnormalIndex": ["体重指数高", "轻度脂肪肝", "乳腺小叶增生", "乳腺结节"]},
                {"checkDate": "2020-09-15", "abnormalIndex": ["体重指数高", "轻度脂肪肝", "乳腺小叶增生"]},
                {"checkDate": "2020-09-16", "abnormalIndex": ["体重指数高", "轻度脂肪肝", "乳腺小叶增生", "乳腺结节"]},
            ],
            "improveRocordVerticalComparisons": [{
                "DRINK_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "SMOKE_complianceStatus": "EXCELLENT",
                "SMOKE_rightOrderNo": "4020200827183158qFR80Zp5",
                "SMOKE_interveneRecordId": 137,
                "DRINK_currentState": "1��1��",
                "DRINK_complianceStatus": "EXCELLENT",
                "SMOKE_improveSuggest": "1����",
                "DRINK_habitType": "DRINK",
                "SMOKE_improveRecordDate": 1599818900000,
                "SMOKE_habitType": "SMOKE",
                "SMOKE_currentState": "1��1��",
                "SMOKE_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "DRINK_improveSuggest": "1����",
                "DRINK_interveneRecordId": 137,
                "DRINK_improveRecordDate": 1599818900000,
                "DRINK_rightOrderNo": "4020200827183158qFR80Zp5"
            }, {
                "DRINK_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "SMOKE_complianceStatus": "EXCELLENT",
                "SMOKE_rightOrderNo": "4020200827183158qFR80Zp5",
                "SMOKE_interveneRecordId": 138,
                "DRINK_currentState": "1��1��",
                "DRINK_complianceStatus": "EXCELLENT",
                "SMOKE_improveSuggest": "1����",
                "DRINK_habitType": "DRINK",
                "SMOKE_improveRecordDate": 1600068133000,
                "SMOKE_habitType": "SMOKE",
                "SMOKE_currentState": "1��1��",
                "SMOKE_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "DRINK_improveSuggest": "1����",
                "DRINK_interveneRecordId": 138,
                "DRINK_improveRecordDate": 1600068133000,
                "DRINK_rightOrderNo": "4020200827183158qFR80Zp5"
            }],
            "interveneRecords": [{
                "doctorId": "18201753201",
                "doctorName": "XX����",
                "nextInterveneDate": 1599904436000,
                "patientRepayType": "ALREADY_KNOW",
                "rightOrderNo": "4020200827183158qFR80Zp5",
                "serviceType": "HEALTH_PROGRAM",
                "smsContent": "我是短信消息",
                "suggest": "ҽ�������ɶ",
                "userCondition": "û״��",
                "userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                remark: "324234234324324"
            }, {
                "doctorId": "18201753201",
                "doctorName": "XX����",
                "nextInterveneDate": 1599904576000,
                "patientRepayType": "ALREADY_KNOW",
                "rightOrderNo": "4020200827183158qFR80Zp5",
                "serviceType": "HEALTH_PROGRAM",
                "smsContent": "我是短信消息",
                "suggest": "ҽ�������ɶ",
                "userCondition": "û״��",
                "userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                remark: "324234234324324"
            }, {
                "doctorId": "18201753201",
                "doctorName": "XX����",
                "nextInterveneDate": 1599904820000,
                "patientRepayType": "ALREADY_KNOW",
                "rightOrderNo": "4020200827183158qFR80Zp5",
                "serviceType": "HEALTH_PROGRAM",
                "smsContent": "我是短信消息",
                "suggest": "ҽ�������ɶ",
                "userCondition": "û״��",
                "userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                remark: "324234234324324"
            }, {
                "doctorId": "18201753201",
                "doctorName": "XX����",
                "nextInterveneDate": 1599905299000,
                "patientRepayType": "ALREADY_KNOW",
                "rightOrderNo": "4020200827183158qFR80Zp5",
                "serviceType": "HEALTH_PROGRAM",
                "smsContent": "我是短信消息",
                "suggest": "ҽ�������ɶ",
                "userCondition": "û״��",
                "userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                remark: "324234234324324"
            }, {
                "doctorId": "18201753201",
                "doctorName": "XX����",
                "nextInterveneDate": 1600154532000,
                "patientRepayType": "ALREADY_KNOW",
                "rightOrderNo": "4020200827183158qFR80Zp5",
                "serviceType": "HEALTH_PROGRAM",
                "smsContent": "我是短信消息",
                "suggest": "ҽ�������ɶ",
                "userCondition": "û״��",
                "userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                remark: "324234234324324"
            }],
            "monitorIndexVerticalComparisons": [{
                "date": 1599818900000,
                "BMI_indexVal": 26.00,
                "BMI_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "BMI_indexUnitType": "KG_M_2",
                "BMI_indexType": "BMI",
                "BMI_indexRecordDate": 1599818900000,
                "BMI_interveneRecordId": 137,
                "BMI_rightOrderNo": "4020200827183158qFR80Zp5"
            }, {
                "date": 1600068133000,
                "BMI_indexUnitType": "KG_M_2",
                "BMI_indexType": "BMI",
                "SBP_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "SBP_rightOrderNo": "4020200827183158qFR80Zp5",
                "BMI_indexRecordDate": 1600068133000,
                "DBP_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "DBP_indexType": "DBP",
                "DBP_rightOrderNo": "4020200827183158qFR80Zp5",
                "DBP_indexVal": 90.00,
                "BMI_indexVal": 26.00,
                "SBP_indexType": "SBP",
                "BMI_userId": "0772e81e-3cab-4582-b07f-fecf647697cb",
                "DBP_indexRecordDate": 1600068133000,
                "SBP_indexVal": 160.00,
                "BMI_interveneRecordId": 138,
                "DBP_indexUnitType": "BPM",
                "SBP_indexUnitType": "BPM",
                "SBP_indexRecordDate": 1600068133000,
                "SBP_interveneRecordId": 138,
                "BMI_rightOrderNo": "4020200827183158qFR80Zp5",
                "DBP_interveneRecordId": 138
            }],
            medicalHistorys: [
                {confirmedTime: "2020-09-14", diseaseType: "疾病类型", operation: "手术", trauma: "外伤", remark: "备注"}
            ],
            familyMedicalHistory: "家族史	"
        },
        msg: "提交成功"
    });
}

module.exports = router

